//
//  UIImage+Helper.h
//  XTMusic
//
//  Created by Ivan Wu on 14-11-24.
//  Copyright (c) 2014年 星途. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIImage (STAdd)

//改变图片的尺寸
- (UIImage *)resizableImageWithContentMode:(UIViewContentMode)contentMode
                                    bounds:(CGSize)bounds
                      interpolationQuality:(CGInterpolationQuality)quality;
- (UIImage *)resizableImage:(CGSize)newSize interpolationQuality:(CGInterpolationQuality)quality;

/**
 *  生成模糊效果图片
 */
- (UIImage *)blurredImageWithRadius:(CGFloat)radius iterations:(NSUInteger)iterations tintColor:(UIColor *)tintColor;
- (UIImage *)blurryWithLevel:(CGFloat)level;
/** 生成灰度化图片*/
- (UIImage*)darkenWithLevel:(CGFloat)level;


/** 
 *  生成圆角图片
 */
+ (instancetype)roundedRectImage:(UIImage*)image size:(CGSize)size radius:(NSInteger)r;



/**
 *  改变图片颜色
 */
- (UIImage *)imageWithColor:(UIColor *)color;
+ (UIImage *)imageWithColor:(UIColor *)color;


/** 
 *  从NSBundle中加载图片
 */
+ (UIImage *)imageWithName:(NSString *)name fromBundle:(NSString *)bundle;


/** 加载最原始的图片，没有渲染 */
+ (instancetype)imageWithOriginalName:(NSString *)imageName;

+ (instancetype)imageWithStretchableName:(NSString *)imageName;

+ (instancetype)resizableWithImageName:(NSString *)imageName;

/**
 *  获取图片部位
 */
- (UIImage *)clipImageInRect:(CGRect)rect;



@end
